<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>动态绑定内联样式——对象语法</title>
</head>
<body>
<div id="app">
    <h1 style="background-color: chocolate; font-size: 32px;">Hello, Vue!</h1>

    <!--目标：通过动态绑定的形式实现字号大小可变-->
    <h1 v-bind:style="{fontSize: size+'px'}">Hello, Vue!</h1>

    <h1 v-bind:style="{backgroundColor: background}">Hello, Vue!</h1>

    <h1 v-bind:style="{fontSize: size+'px', backgroundColor: background}">Hello, Vue!</h1>
</div>

<script type="module">
    import {createApp, ref} from "../../../js/vue.esm-browser.js";

    let app = createApp(
        {
            setup() {
                let size = ref(64)
                let background = ref('red')
                return {
                    size,
                    background
                }
            }
        }
    );

    app.mount("#app")
</script>
</body>
</html>